package com.stone.stoneanswer.model.vo;

import cn.hutool.db.Page;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.stone.stoneanswer.model.entity.AnswerResult;
import com.stone.stoneanswer.model.entity.Post;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class AnswerResultVO  implements Serializable {

    /**
     * id
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 作答题库
     */
    private Long questionBankId;

    private String questionBankName;

    private String analyzeResult;

    /**
     * 创建时间
     */
    private Date updateTime;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 选项列表（json 字符串，题目ID为key，选项为value）
     */
    private String options;

    /**
     * 判题结果（json 字符串，题目ID为key，选项为value）
     */
    private String judgeOptions;

    /**
     * 得分
     */
    private Integer score;

    /**
     * 创建用户ID
     */
    private Long userId;

    /**
     * 包装类转对象
     *
     * @return
     */
    public static AnswerResult voToObj(AnswerResultVO answerResultVO) {
        if (answerResultVO == null) {
            return null;
        }
        AnswerResult answerResult = new AnswerResult();
        BeanUtils.copyProperties(answerResultVO, answerResult);

        return answerResult;
    }

    /**
     * 对象转包装类
     *
     * @return
     */
    public static AnswerResultVO objToVo(AnswerResult answerResult) {
        if (answerResult == null) {
            return null;
        }
        AnswerResultVO answerResultVO = new AnswerResultVO();
        BeanUtils.copyProperties(answerResult, answerResultVO);
        return answerResultVO;
    }
}